
function getVal(s){
  return document.getElementById(s).value;
}

function val_sbb(){
    var str = getVal("bbname");
		var res;
    if(!str || str == ' '){
    	$("#span_bb_name").html("BioBit name can't be empty");
    	$("#span_bb_name").addClass("errorForm");
        res= false;
    }else{
	res=true;
	}
    return res;
}

function val_ehw(){
	$("#span_hws_name").html("name"); 
	$("#span_hws_name").removeClass("errorForm");
	$("#hws_name").removeClass("errorForm");
	$("#span_hws_comments").html("hws comments"); 
	$("#span_hws_comments").removeClass("errorForm");
	$("#hws_comments").removeClass("errorForm");
	$("#span_hws_testBy").html("testBy"); 
	$("#span_hws_testBy").removeClass("errorForm");
	$("#hws_testBy").removeClass("errorForm");

	var res = true;

   if(getVal("hws_name")=="" ){
      $("#span_hws_name").html("The name can't be empty"); 
		$("#span_hws_name").addClass("errorForm");
		$("#hws_name").addClass("errorForm");
		res = false;
	}
   if(getVal("hws_comments")=="" ){
      $("#span_hws_comments").html("The name can't be empty"); 
		$("#span_hws_comments").addClass("errorForm");
		$("#hws_comments").addClass("errorForm");
		res = false;
	}
  if(getVal("hws_testBy")=="" ){
      $("#span_hws_testBy").html("The name can't be empty"); 
		$("#span_hws_testBy").addClass("errorForm");
		$("#hws_testBy").addClass("errorForm");
		res = false;
	}
 
	return res;
}

function val_rws(){
	$("#span_rws_name").html("name"); 
	$("#span_rws_name").removeClass("errorForm");
	$("#rws_name").removeClass("errorForm");
	$("#span_rws_comments").html("rws comments"); 
	$("#span_rws_comments").removeClass("errorForm");
	$("#rws_comments").removeClass("errorForm");
	$("#span_rws_testBy").html("testBy"); 
	$("#span_rws_testBy").removeClass("errorForm");
	$("#rws_testBy").removeClass("errorForm");
	
	$("#span_rws_targInd").html("target Inductor"); 
	$("#span_rws_targInd").removeClass("errorForm");
	$("#targInd").removeClass("errorForm");
	$("#span_rws_targInd_species").html("Specie!"); 
	$("#span_rws_targInd_species").removeClass("errorForm");
	$("#targInd_species").removeClass("errorForm");
	$("#span_rws_targInd_fasta").html("FASTA"); 
	$("#span_rws_targInd_fasta").removeClass("errorForm");
	$("#targInd_fasta").removeClass("errorForm");

	var res = true;
   if(getVal("rws_name")=="" ){
      $("#span_rws_name").html("The name can't be empty"); 
		$("#span_rws_name").addClass("errorForm");
		$("#rws_name").addClass("errorForm");
		res = false;
	}
   if(getVal("rws_comments")=="" ){
      $("#span_rws_comments").html("The name can't be empty"); 
		$("#span_rws_comments").addClass("errorForm");
		$("#rws_comments").addClass("errorForm");
		res = false;
	}
  if(getVal("rws_testBy")=="" ){
      $("#span_rws_testBy").html("The name can't be empty"); 
		$("#span_rws_testBy").addClass("errorForm");
		$("#rws_testBy").addClass("errorForm");
		res = false;
	}
 if(getVal("targInd")=="" ){
      $("#span_rws_targInd").html("The target inductor can't be empty"); 
		$("#span_rws_targInd").addClass("errorForm");
		$("#targInd").addClass("errorForm");
		res = false;
	}
 if(getVal("targInd_species")=="" ){
      $("#span_rws_targInd_species").html("The target inductor specie can't be empty"); 
		$("#span_rws_targInd_species").addClass("errorForm");
		$("#targInd_species").addClass("errorForm");
		res = false;
	}

 if(getVal("targInd_fasta")=="" ){
      $("#span_rws_targInd_fasta").html("The FASTA of the target inductor can't be empty"); 
		$("#span_rws_targInd_fasta").addClass("errorForm");
		$("#targInd_fasta").addClass("errorForm");
		res = false;
	}
 
	return res;
}


function val_sink(){
	//TODO: Cambiar los nombres
	$("#span_sink_name").html("name"); 
	$("#span_sink_name").removeClass("errorForm");
	$("#sink_name").removeClass("errorForm");
	$("#span_sink_comments").html("sink comments"); 
	$("#span_sink_comments").removeClass("errorForm");
	$("#sink_comments").removeClass("errorForm");
	$("#span_sink_testBy").html("testBy"); 
	$("#span_sink_testBy").removeClass("errorForm");
	$("#sink_testBy").removeClass("errorForm");

	var res = true;

   if(getVal("sink_name")=="" ){
	  $("#span_sink_name").html("The name can't be empty"); 
		$("#span_sink_name").addClass("errorForm");
		$("#sink_name").addClass("errorForm");
		res = false;
	}
   if(getVal("sink_comments")=="" ){
	  $("#span_sink_comments").html("The name can't be empty"); 
		$("#span_sink_comments").addClass("errorForm");
		$("#sink_comments").addClass("errorForm");
		res = false;
	}
  if(getVal("sink_testBy")=="" ){
	  $("#span_sink_testBy").html("The name can't be empty"); 
		$("#span_sink_testBy").addClass("errorForm");
		$("#sink_testBy").addClass("errorForm");
		res = false;
	}
 
	return res;
}




function val_bb(id){
	$("#span_biobit_link"+id).html("DB Link"); 
	$("#span_biobit_link"+id).removeClass("errorForm");
	$("#biobit_link"+id).removeClass("errorForm");
	$("#span_biobit_desc"+id).html("Description"); 
	$("#span_biobit_desc"+id).removeClass("errorForm");
	$("#biobit_desc"+id).removeClass("errorForm");
	$("#span_biobit_name"+id).html("What's BioBit name?"); 
	$("#span_biobit_name"+id).removeClass("errorForm");
	$("#biobit_name"+id).removeClass("errorForm");
	
	var res = true;
  if(getVal("biobit_name"+id)=="" ){
      $("#span_biobit_name"+id).html("BioBit name can't be empty"); 
		$("#span_biobit_name"+id).addClass("errorForm");
		$("#biobit_name"+id).addClass("errorForm");
		res = false;
	}
  if(getVal("biobit_desc"+id)==""){
      $("#span_biobit_desc"+id).html("BioBit description can't be empty"); 
		$("#span_biobit_desc"+id).addClass("errorForm");
		$("#biobit_desc"+id).addClass("errorForm");
		res = false;
	}
  /*if(getVal("biobit_link"+id)==""){
		$("#span_biobit_link"+id).html("BioBit link can't be empty"); 
		$("#span_biobit_link"+id).addClass("errorForm");
		$("#biobit_link"+id).addClass("errorForm");
		res = false;
	}*/

	return res;
 
}

function val_gen(id){

	$("#span_gen_name"+id).html("What's gen name?"); 
	$("#span_gen_name"+id).removeClass("errorForm");
	$("#g_name"+id).removeClass("errorForm");
	
	$("#span_gen_spice"+id).html("What specie does the gen belong?"); 
	$("#span_gen_spice"+id).removeClass("errorForm");
	$("#g_spice"+id).removeClass("errorForm");
	
	$("#span_gen_codsus"+id).html("What's substance does it enconde?"); 
	$("#span_gen_codsus"+id).removeClass("errorForm");
	$("#bb_g_codSus"+id).removeClass("errorForm");
	
	/*
	$("#span_gen_bblink"+id).html("The BioBrick link"); 
	$("#span_gen_bblink"+id).removeClass("errorForm");
	$("#bb_g_linkBB"+id).removeClass("errorForm");
	
	$("#span_gen_bdlink"+id).html("Other database link"); 
	$("#span_gen_bdlink"+id).removeClass("errorForm");
	$("#bb_g_linkBD"+id).removeClass("errorForm");
	*/
	
	$("#span_gen_fasta"+id).html("Fasta sequence"); 
	$("#span_gen_fasta"+id).removeClass("errorForm");
	$("#bb_g_fasta"+id).removeClass("errorForm");
	
  var res = true;
  if(getVal("g_name"+id)=="" ){
        $("#span_gen_name"+id).html("Gen name can't be empty"); 
		$("#span_gen_name"+id).addClass("errorForm");
		$("#g_name"+id).addClass("errorForm");
		res = false;
	}
  if(getVal("g_spice"+id)==""){
      $("#span_gen_spice"+id).html("The species can't be empty"); 
		$("#span_gen_spice"+id).addClass("errorForm");
		$("#g_spice"+id).addClass("errorForm");
		res = false;
	}
  if(getVal("bb_g_codSus"+id)==""){
		$("#span_gen_codsus"+id).html("The encoding substance can't be empty"); 
		$("#span_gen_codsus"+id).addClass("errorForm");
		$("#bb_g_codSus"+id).addClass("errorForm");
		res = false;
	}
  
  /*
   if(getVal("bb_g_linkBB"+id)==""){
		$("#span_gen_bblink"+id).html("BioBrick link can't be empty"); 
		$("#span_gen_bblink"+id).addClass("errorForm");
		$("#bb_g_linkBB"+id).addClass("errorForm");
		res = false;
	}
  if(getVal("bb_g_linkBD"+id)==""){
		$("#span_gen_bdlink"+id).html("Other database link can't be empty"); 
		$("#span_gen_bdlink"+id).addClass("errorForm");
		$("#bb_g_linkBD"+id).addClass("errorForm");
		res = false;
	}
	*/
  if(getVal("bb_g_fasta"+id)==""){
		$("#span_gen_fasta"+id).html("Fasta sequence link can't be empty"); 
		$("#span_gen_fasta"+id).addClass("errorForm");
		$("#bb_g_fasta"+id).addClass("errorForm");
		res = false;
	} 
 

	return res;
 
}